package main

import (
	"fmt"
	"reflect"
)

type tt struct {
	a string `json:"a"`
}

func (t *tt) Driver() {

}

type Car interface {
	Driver()
}

type Suv struct {
}

func (s Suv) Driver() {

}

func getTag() {

	var aa = tt{a: "123"}
	fmt.Println(reflect.TypeOf(aa).Field(0).Tag.Get("json"))

	fmt.Println(reflect.ValueOf(aa).Method(0).Type().Name())
	fmt.Println(reflect.TypeOf(aa).Method(0).Name)

}

func iterTest() {

	//结构体
	var s Car = Suv{}
	s.Driver()
	var tt1 Car = tt{}
	tt1.Driver()

	//指针
	var s1 Car = &Suv{}
	s1.Driver()
	var t Car = &tt{}
	t.Driver()
}

func main() {

	var c Car = Suv{}
	suv := c.(Suv)
	fmt.Println(suv)

	switch c.(type) {
	case Car:
		fmt.Println("car")
	case Suv:
		fmt.Println("suv")
	}
}
